define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user.withdraw/index',
        add_url: 'user.withdraw/add',
        edit_url: 'user.withdraw/edit',
        delete_url: 'user.withdraw/delete',
        export_url: 'user.withdraw/export',
        modify_url: 'user.withdraw/modify',
        audio_url: 'user.withdraw/audio',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {type: 'checkbox'},
                    // {field: 'id', title: 'id'},
                    // {field: 'user_id', title: '会员ID'},
                    // {field: 'order_sn', title: '提现流水号'},
                    {field: 'true_name', title: '真实姓名'},
                    {field: 'check_status', search: 'select', selectList: ea.getDataBrage('select_list_check_status'), title: '审核状态'},
                    {field: 'cash_status', search: 'select', selectList: {'0':'转帐中','1':'转账成功','2':'转账拒绝','3':' '}, title: '转账状态'},
                    // {field: 'check_time', title: '审核时间'},
                    // {field: 'cash_time', title: '转账时间'},
                    {field: 'account_type', search: 'select', selectList: ea.getDataBrage('select_list_account_type'), title: '账户类型'},
                    {field: 'account', title: '提现账户'},
                    {field: 'qrcode', title: '收款二维码', templet: ea.table.image},
                    {field: 'bank_name', title: '开户行'},
                    {field: 'bank_type', title: '银行卡类型'},
                    {field: 'cash_fee', title: '提现金额'},
                    {field: 'handling_fee', title: '手续费'},
                    {field: 'pay_fee', title: '到账金额'},
                    {field: 'create_time', title: '申请时间'},
                    {field: 'check_reason', title: '审核失败原因'},
                    {field: 'cash_reason', title: '付款异常原因'},
                    // {field: 'transaction_id', title: '第三方订单号'},
                    {width: 250, title: '操作', templet: ea.table.tool , fixed:'right', operat: [
                        [{
                            text: '审核',
                            url: init.edit_url+'?types=1',
                            method: 'open',
                            class: 'layui-btn layui-btn-xs layui-btn-success',
                            extend: '',
                            _if: function (data, operat) {
                                if(data.check_status === 0){
                                    return true;
                                }else{
                                    return false;
                                }
                            },
                        }, {
                            text: '转账',
                            url: init.edit_url+'?types=2',
                            method: 'open',
                            class: 'layui-btn layui-btn-xs layui-btn-success',
                            extend: '',
                            _if: function (data, operat) {
                                if(data.check_status === 1 && data.cash_status == 0){
                                    return true;
                                }else{
                                    return false;
                                }
                            },
                        }, ]]},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});